import axios from '@/plugins/axios'

// 链接跳转获取token
export async function replaceToken (params) {
  try {
    let res = await axios.post(`/app/staff/login/replaceToken`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// pc登录二维码
export async function getLoginPic (params) {
  try {
    let res = await axios.post(`/app/staff/login/loginPic`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 检查登录（每一秒请求一次）
export async function checkLoginStatus (params) {
  try {
    let res = await axios.post(`/app/staff/login/checkStatus`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 忘记密码发邮件
export async function forgetThePassword (params) {
  try {
    let res = await axios.post(`/app/staff/login/forgetThePassword`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 用验证码重置密码
export async function resetPassword (params) {
  try {
    let res = await axios.post(`/app/staff/login/resetPassword`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
